#ifndef FLASHDRIVER_H_
#define FLASHDRIVER_H_

#include "DSP2833x_Device.h"

class FlashDriver
{
public:
	bool Init();
	bool IsReady();
	void BulkErase();
	bool WritePage16(Uint32 address, unsigned char* buffer);
	void ReadPage16(Uint32 address, unsigned char* buffer);
	
private:
	void SetupSPI();
	unsigned char WriteByte(unsigned char data);
	void WriteWREN();
	void ReadID(char* buffer);
	bool WritePage(Uint32 address, unsigned char* buffer);
	void ReadPage(Uint32 address, unsigned char* buffer);
};

#endif /*FLASHDRIVER_H_*/
